#include "Token.h"
#include <format>


namespace Pomian
{
	IToken::IToken(int lineNumber)
		:m_lineNumber(lineNumber)
	{
	}

	NumberToken::NumberToken(int lineNumber, const std::string& word)
		: IToken(lineNumber)
		, m_number(std::stoi(word))
	{
	}
	NumberToken::operator int()
	{
		return m_number;
	}
	std::string NumberToken::toWord()
	{
		return std::format("{}", m_number);
	}
	IdentifierToken::IdentifierToken(int lineNumber, const std::string& word)
		: IToken(lineNumber)
		, m_identifier(word)
	{
	}	

	SeperatorToken::SeperatorToken(int lineNumber, const std::string& word)
		: IToken(lineNumber)
		, m_seperator(word)
	{
	}

	FlagToken::FlagToken()
		: IToken(0)
	{
	}

	IdentifierToken::operator std::string()
	{
		return m_identifier;
	}

	std::string FlagToken::toWord()
	{
		return "Flag";
	}

	FlagToken::operator std::string()
	{
		return "Flag";
	}

	FlagToken* FlagToken::EoL = new FlagToken();

	FlagToken* FlagToken::EoF = new FlagToken();

	StringToken::operator std::string()
	{
		return m_string;
	}

	std::string StringToken::toWord()
	{
		return m_string;
	}

	SeperatorToken::operator std::string()
	{
		return m_seperator;
	}

	std::string SeperatorToken::toWord()
	{
		return m_seperator;
	}

	std::string IdentifierToken::toWord()
	{
		return m_identifier;
	}

	KeywordToken::KeywordToken(int lineNumber, const std::string& word)
		: IToken(lineNumber)
		, m_keyword(word)
	{
	}

	KeywordToken::operator std::string()
	{
		return m_keyword;
	}

	std::string KeywordToken::toWord()
	{
		return m_keyword;
	}

	OperatorToken::OperatorToken(int lineNumber, const std::string& word)
		: IToken(lineNumber)
		, m_operator(word)
	{

	}

	OperatorToken::operator std::string()
	{
		return m_operator;
	}

	std::string OperatorToken::toWord()
	{
		return m_operator;
	}

	StringToken::StringToken(int lineNumber, const std::string& word)
		: IToken(lineNumber)
		, m_string(word)
	{
	}

}

